from tkinter import *

import tkinter .messagebox

win = Tk()
win.config(bg='#87CEEB')
win.title("YoLo")
win.geometry('450x350+300+200')
win.iconbitmap("qianduan\logo.ico")

def menuCommand():
  tkinter .messagebox.showinfo("下拉菜单","您正在使用下拉菜单功能")

mainmenu = Menu(win)

filemenu =Menu(mainmenu,tearoff=False)

filemenu.add_command(label="新建",command=menuCommand,accelerator="Ctrl+N")
filemenu.add_command(label="打开",command=menuCommand,accelerator="Ctrl+O")
filemenu.add_command(label="保存",command=menuCommand,accelerator="Ctrl+S")

filemenu.add_separator()
filemenu.add_command(label="退出",command=win.quit)

mainmenu.add_cascade(label="文件",menu=filemenu)

win.config(menu=mainmenu)

win.bind("<Control-n>",lambda event:menuCommand())
win.bind("<Control-N>",lambda event:menuCommand())
win.bind("<Control-o>",lambda event:menuCommand())
win.bind("<Control-O>",lambda event:menuCommand())
win.bind("<Control-s>",lambda event:menuCommand())
win.bind("<Control-S>",lambda event:menuCommand())
# 显示主窗口
win.mainloop()